package cronjob

import (
	"fmt"
	"io"
	"net/http"
	"strconv"
	"sync"
)

func HttpGetPing(i int, wg *sync.WaitGroup) {
	defer wg.Done()
	id := strconv.Itoa(i)
	url := "http://14.103.11.60:8090/api/v1/publish/ping?id=" + id // 替换为你想要请求的URL

	// 发送GET请求
	resp, err := http.Get(url)
	if err != nil {
		fmt.Printf("请求失败：%s", err)
		return
	}
	defer func(Body io.ReadCloser) {
		err := Body.Close()
		if err != nil {

		}
	}(resp.Body)

	// 读取响应内容
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("读取响应内容失败：%s", err)
		return
	}

	// 输出响应内容
	fmt.Println(string(body))
}
